package com.eistert.java.algorithm.tencommonalgorithms.prim;

import java.util.Arrays;

/**
 * @Description:
 * @Author: ai
 * @create: 2023-04-22 10:30
 */
public class MinTree {
    public MinTree() {
    }

    /**
     * 创建图的领接矩阵
     *
     * @param graph  图对象
     * @param verxs  图对应的顶点个数
     * @param data   图的各个顶点的值
     * @param weight 图的领接矩阵
     */
    public void createGraph(MGraph graph, int verxs, char[] data, int[][] weight) {


        for (int i = 0; i < verxs; i++) { // 总共有几行
            graph.data[i] = data[i];

            for (int j = 0; j < verxs; j++) { //
                graph.weight[i][j] = weight[i][j];
            }
        }
    }

    /**
     * 显示图的领接矩阵
     *
     * @param graph
     */
    public void showGraph(MGraph graph) {
        for (int[] link : graph.weight) {
            System.out.println(Arrays.toString(link));
        }
    }




}
